# -*- coding: utf-8 -*-
#!/usr/bin/env python
from google.appengine.ext import db


class User(db.Model):
    '''
    客户实体,不使用google用户
    '''
    username = db.StringProperty(multiline=False)
    password = db.StringProperty(multiline=False)
    mobile_no = db.StringProperty(multiline=False)
    mobile_pwd = db.StringProperty(multiline=False)
    create_date = db.DateTimeProperty(auto_now_add=True)
    last_login = db.DateTimeProperty()
    last_ip = db.StringProperty(multiline=False)
    running = db.BooleanProperty()
            

class City(db.Model):
    '''
    城市列表
    '''
    name = db.StringProperty(multiline=False)
    url = db.StringProperty(multiline=False)
    remark = db.StringProperty()
    
class SendUsers(db.Model):
    '''
    发送列表
    '''
    name = db.StringProperty(multiline=False)
    number = db.StringProperty(multiline=False)
    city = db.ReferenceProperty(City)
    user = db.ReferenceProperty(User)


class WeatherStore(db.Model):
    '''
    每天保存天气
    '''
    message = db.StringProperty(multiline=False)
    date = db.StringProperty(multiline=False)
    city = db.ReferenceProperty(City)
    
class FetionLog(db.Model):
    '''
    发送日志
    '''
    sendname = db.StringProperty(multiline=False)
    senddate = db.DateTimeProperty()
    username = db.StringProperty(multiline=False) #所属用户
    weather = db.ReferenceProperty(WeatherStore) #天气记录
    status = db.StringProperty(multiline=False)